<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""DTD/xhtml1-strict.dtd">
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%>
<%@taglib uri="/WEB-INF/el.tld" prefix="el"%>
<%@taglib uri="/WEB-INF/fn.tld" prefix="fn"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title></title>
		<c:import url="/includes/css_inc.jsp"/>
		<c:import url="/includes/js_inc.jsp"/>
		<script>
		$(function(){
			$("#btnConfirm").button({
	            icons: {
	                primary: "ui-icon-disk"
	            }
			}).click(function(){
				if(confirm('คุณต้องการยืนยันการส่งข้อมูล?')==true){
					disableField(["btnConfirm","btnBack","btnCancel"]);
					$("#btnConfirm").addClass("ui-button-disabled ui-state-disabled");
					$("#btnBack").addClass("ui-button-disabled ui-state-disabled");
					$("#btnCancel").addClass("ui-button-disabled ui-state-disabled");
					$("#saveForm").submit();
				}
			});
			$("#btnCancel").button({
	            icons: {
	                primary: "ui-icon-arrowreturnthick-1-w"
	            }
			}).click(function(){
				if(confirm('คุณต้องการส่งแก้ไขรายการหรือไม่?')==true){
					$("#job").val("cancel");
					$("#saveForm").submit();
				}
			});
			$("#btnBack").button({
	            icons: {
	                primary: "ui-icon-arrowreturnthick-1-w"
	            }
			}).click(function(){
				$("#job").val("back");
				$("#saveForm").submit();
			});
		});
		</script>
	</head>
	<body>
		<c:set var="auth" value="${el:getMapValue(menuAuth, 'ACC60311')}"/>
		<c:import url="/apps/msg.jsp"/>
		<form class="acc67-form" name="saveForm" id="saveForm" action="${pageContext.request.contextPath}/acc6" method="post">
		<input type="hidden" name="app" id="app" value="ACC60311"/>
		<input type="hidden" name="job" id="job" value="${job}"/>
		<input type="hidden" name="docNo" id="docNo" value="${acb.docNo}"/>
		<input type="hidden" name="provinceId" id="provinceId" value="${acb.provinceId}"/>
		<input type="hidden" name="chequeDate" id="chequeDate" value="${el:dateTh(acb.chequeDate)}"/>
		<input type="hidden" name="chequeNo" id="chequeNo" value="${acb.chequeNo}"/>
		<table width="100%" class="ui-widget ui-widget-content" border="0">
			<tr>
				<th align="left" class="acc67-header ui-widget-header" colspan="2"><b>${screenCode.ACC60311}</b></th>
			</tr>
			<tr>
				<td class="bold" width="15%">เลขที่เอกสาร : </td>
				<td>${acb.docNo}</td>
			</tr>
			<tr>
				<td class="bold">จังหวัด : </td>
				<td>${provinceName}</td>
			</tr>
			<tr>
				<td class="bold">วันที่ cheque: </td>
				<td>${el:dateTh(acb.chequeDate)}</td>
			</tr>
			<tr>
				<td class="bold">ชื่อผู้รับผิดชอบ : </td>
				<td>${acb.responsibleName}</td>
			</tr>
			<tr>
				<td class="bold">เลขที่ cheque : </td>
				<td>${acb.chequeNo}</td>
			</tr>
			<tr>
				<td class="bold" valign="top">ชื่อโครงการ/คำอธิบาย : </td>
				<td>${acb.chequeDesc}</td>
			</tr>
			<tr>
				<td colspan="2">
					<fieldset>
						<legend>รายละเอียดการจ่าย cheque</legend>
						<table width="100%" class="acc67-grid ui-widget ui-widget-content" id="payTableDetail">
							<tr>
								<th align="center" class="ui-state-default" width="7%">เลขที่เอกสารอ้างอิง</th>
								<th align="center" class="ui-state-default" width="7%">ปีงบประมาณ</th>
								<th align="center" class="ui-state-default" width="9%">กองทุนย่อยเฉพาะด้าน</th>
								<th align="center" class="ui-state-default" width="9%">หน่วยบริการ/คู่สัญญา</th>
								<th align="center" class="ui-state-default" width="9%">หมวดการจ่าย</th>
								<th align="center" class="ui-state-default" width="7%">จำนวนเงิน</th>
								<th align="center" class="ui-state-default" width="5%">ภาษี</th>
								<th align="center" class="ui-state-default" width="5%">เงินยืม</th>
							</tr>
							<c:if test="${!empty lsChequeDetail}">
								<c:forEach items="${lsChequeDetail}" var="data" varStatus="x">
										<c:if test="${acb.chequeStatus == 'Y'}">
										<tr style="background-color: #8eee81;">
										</c:if>
										<c:if test="${acb.chequeStatus != 'Y'}">
											<tr>
										</c:if>
											<td align="center">${data.refNo}</td>
											<td align="center">${data.budgetYear}</td>
											<td align="left"><span title="${data.allocateName}">${data.allocateCode} : ${data.allocateSub}</span></td>
											<td align="left"><span title="${data.venderName}">${data.venderSub}</span></td>
											<td align="left">
												<c:if test="${fn:length(el:getDataUtil('CAT',data.categoryId)) > 10}">
													<span title="${el:getDataUtil('CAT',data.categoryId)}">${fn:substring(el:getDataUtil('CAT',data.categoryId),0,10)}...</span>
												</c:if>
												<c:if test="${fn:length(el:getDataUtil('CAT',data.categoryId)) <= 10}">
													<span title="${el:getDataUtil('CAT',data.categoryId)}">${el:getDataUtil('CAT',data.categoryId)}</span>
												</c:if>
											</td>
											<td align="right"><fmt:formatNumber pattern="#,##0.00" value="${data.chequeAmount}" /></td>
											<td align="right"><fmt:formatNumber pattern="#,##0.00" value="${data.taxValue}" /></td>
											<td align="center">
												<input type="checkbox" ${data.isBorrow=='Y'?'checked':''} disabled="disabled"/>
											</td>
											<input type="hidden" name="chequeSeq" value="${data.chequeSeq}"/>
											<input type="hidden" name="refNo" value="${data.refNo}"/>
											<input type="hidden" name="budgetYear" value="${data.budgetYear}"/>
											<input type="hidden" name="allocateCode" value="${data.allocateCode}"/>
											<input type="hidden" name="venderCode" value="${data.venderCode}"/>
											<input type="hidden" name="categoryId" value="${data.categoryId}"/>
											<input type="hidden" name="chequeAmount" value="${data.chequeAmount}"/>
											<input type="hidden" name="taxValue" value="${data.taxValue}"/>
											<input type="hidden" name="isBorrow" value="${data.isBorrow}"/>
										</tr>
								</c:forEach>
							</c:if>
						</table>
					</fieldset>
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<c:if test="${acb.chequeStatus == 'A'}">
						<c:if test="${fn:contains(auth, 'U')}">
							<button type="button" name="btnConfirm" id="btnConfirm" class="acc67-button">ยืนยันการส่งข้อมูล</button>
							<button type="button" name="btnCancel" id="btnCancel" class="acc67-button">ส่งคืนแก้ไข</button>
						</c:if>
						<button type="button" name="btnBack" id="btnBack" class="acc67-button">ย้อนกลับ</button>
					</c:if>
					<c:if test="${acb.chequeStatus != 'A'}">
						<button type="button" name="btnBack" id="btnBack" class="acc67-button">ย้อนกลับ</button>
					</c:if>
				</td>
			</tr>
		</table>
		</form>
	</body>
</html>